import {
  getOrders
} from "api/api"

export default {
  state: {
    orders:[]
  },
  getters: {
    
  },
  mutations: {
    getOrders(state,orders){
      state.orders = orders
    }
  },
  actions: {
    async getOrders(store,{page,limit}){
      try{
        const {code,data} = await getOrders(page,limit);
        if(code===200)
          store.commit("getOrders",data.records)
        return {code,data}
      }catch(err){
        return err
      }
    }
  }
}
